<template>
  <div class="page-main" v-title :data-title="dataTitle ? dataTitle : '验收付款列表'">
    <FixedMenu/>
    <home-nav :userData="userinfo"></home-nav>
    <div class="banner"><span>合同验收付款审批表</span></div>
    <div class="container">
      <div class="header">
        <a-row type="flex" justify="space-between" align="middle">
          <a-col :xl="{ span: 14 }" :lg="{ span: 11 }">
            <a-button
              v-if="checkPermission(['WORK_REPORT_MANAGER', 'WORK_REPORT_ACCEPTER', '合同报工员', '合同报工参与人'])"
              @click="exportExcle"
              class="hte-btn add-btn"
              type="primary"
              >导出</a-button
            >
            <a-button
              v-if="checkPermission(['WORK_REPORT_MANAGER', 'WORK_REPORT_ACCEPTER', '合同报工员', '合同报工参与人'])"
              @click="fetchList"
              class="hte-btn"
              >刷新</a-button
            >
            <a-button class="hte-btn add-btn" type="primary" @click="print">付款打印</a-button>
            <a-button class="hte-btn add-btn" type="primary" @click="print1">验收打印</a-button>
            <a-button  @click="batchUpdateStatus" class="hte-btn">更新状态</a-button>

            <a-button  @click="syncHYInfo" class="hte-btn">同步海银信息</a-button>

          </a-col>
          <a-col :xl="{ span: 9 }" :lg="{ span: 13 }" class="input-ground">
            <a-input-group compact>
              <a-select v-model="keywordType">
                <a-select-option value="1"> 订单号 </a-select-option>
                <a-select-option value="2"> 流水号 </a-select-option>
              </a-select>
              <a-input-search
                v-if="keywordType == '1'"
                v-model="searchForm.purchaseOrderNumber"
                @search="handleSearch"
                placeholder="请按照关键字进行搜索"
              />
              <a-input-search
                v-else
                v-model="searchForm.applyNo"
                @search="handleSearch"
                placeholder="请按照关键字进行搜索"
              />
            </a-input-group>
            <a-button class="hte-btn del-btn" @click="openSearchForm">高级搜索</a-button>
          </a-col>
        </a-row>
      </div>
      <div class="content-list">
        <a-table
          :scroll="{ x: '100%' }"
          class="hte-table-content"
          :columns="[...paymentColumns, ...deleteColums]"
          :data-source="records"
          rowKey="id"
          bordered
          :pagination="false"
          @change="handleTableChange"
          :customRow="customRow"
          :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
        >
          <template slot="handlerStepRender" slot-scope="text, record">
            <span v-if="record.status == '1'">
              {{ record.handlerStep }}
            </span>
          </template>
          <template slot="currentHandlerRender" slot-scope="text, record">
            {{ currentHandlerRenderFunc(record) }}
          </template>
          <template slot="statusRender" slot-scope="text, record">
            <a-tooltip>
              <template #title>状态不对?点我更新</template>
              <a-icon type="sync" @click="updateStatus(record.id)" />
            </a-tooltip>
            <template v-for="(code, index) in codes.WorkReportTaskPaymentStatus">
              <span :key="index" v-if="record.status == code.code"> {{ code.name }} </span>
            </template>
          </template>
          <template slot="applyNoRender" slot-scope="text, record">
            <span class="font-active" @click="toPaymentDetail(record)"> {{ record.applyNo }} </span>
          </template>

          <template slot="orderStatusRender" slot-scope="text, record">
            <span> {{ transferCodeToName(record.orderStatus,saOrderStatus) }} </span>
          </template>
          
          <template slot="bizStatusRender" slot-scope="text, record">
            <span> {{ transferCodeToName(record.bizStatus,saBizStatus) }} </span>
          </template>
          
          <template slot="relatedQualityNosRender" slot-scope="text, record">
            <!--
              <span class="font-active"> {{ convertRelateQuality(record.relatedQualityNos,record.isRelatedQuality) }} </span>
            -->
            <span> {{ convertRelateQuality(record.relatedQualityNos,record.isRelatedQuality) }} </span>
          </template> 
          
          <span slot="actionRender" slot-scope="text, record">
            <div style="display:flex;justify-content:center">
            <span  class="font-active" v-if="record.status == 2" @click="pushToSrm(record)">推送SRM</span>
            <span  class="font-active" v-if="record.status == 2" @click="pushToBi(record)">推送BI</span>
            <span
              v-if="
                (['1', '3'].indexOf(record.status) > -1 && record.applyUserId == currUserId) || record.status == '0'
              "
              class="font-active"
              style="cursor: pointer"
              @click="toDelPayment(record)"
            >
              删除
            </span>
          </div>
          </span>
        </a-table>
        <a-pagination
          show-size-changer
          :default-current="1"
          :total="searchForm.total"
          @change="pageChange"
          @showSizeChange="onShowSizeChange"
          :show-total="(total) => `共 ${total} 条记录`"
        />
      </div>
    </div>
    <a-modal
      :visible="showSearchForm"
      width="70vw"
      :bodyStyle="{ padding: '10px' }"
      title="高级查询"
      @ok="handleToSearch"
      @cancel="handleToCancel"
    >
      <a-form-model ref="ruleForm" :label-col="labelCol" :wrapper-col="wrapperCol" @keyup.enter.native="handleToSearch">
        <a-row :gutter="24">
          <a-col :span="8">
            <a-form-model-item label="状态">
              <a-select mode="multiple" v-model="searchForm.statusList" style="width: 100%" :allowClear="true">
                <a-select-option
                  v-for="(code, index) in codes.WorkReportTaskPaymentStatus"
                  :key="index"
                  :value="code.code"
                >
                  {{ code.name }}
                </a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="订单号">
              <a-input allow-clear v-model="searchForm.purchaseOrderNumber" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="流水号">
              <a-input allow-clear v-model="searchForm.applyNo" />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="8">
            <a-form-model-item label="签订公司">
              <a-input allow-clear v-model="searchForm.signCompany" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="供应商">
              <a-input allow-clear v-model="searchForm.supplierName" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="当前步骤">
              <a-input allow-clear v-model="searchForm.handlerStep" />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="8">
            <a-form-model-item label="申请人">
              <a-input allow-clear v-model="searchForm.applyUserName" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="申请日期-开始">
              <a-date-picker
                allow-clear
                style="width: 100%"
                valueFormat="YYYY-MM-DD"
                v-model="searchForm.applyTimeStart"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="申请日期-结束">
              <a-date-picker
                allow-clear
                style="width: 100%"
                valueFormat="YYYY-MM-DD"
                v-model="searchForm.applyTimeEnd"
              />
            </a-form-model-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="8">
            <a-form-model-item label="当前处理人">
              <a-input allow-clear v-model="searchForm.handlerUser" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="合同跟进专员">
              <a-input allow-clear v-model="searchForm.createOrderUser" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8"> </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="8">
            <a-form-model-item label="结算员">
              <a-input allow-clear v-model="searchForm.settlementUser" />
            </a-form-model-item>
          </a-col>
          <a-col :span="8">
            <a-form-model-item label="结算时间">
              <a-range-picker
                v-model="settlementTime"
                :show-time="{ format: 'YYYY-MM-DD' }"
                valueFormat="YYYY-MM-DD"
                format="YYYY-MM-DD"
                :placeholder="['开始时间', '结束时间']"
              />
            </a-form-model-item>
          </a-col>
          <a-col :span="8"> </a-col>
        </a-row>
      </a-form-model>
    </a-modal>
    <!-- 付款打印页面排版 -->
    <div style="visibility: hidden; position: fixed">
      <printPayment ref="printPayment" :printJobs="printJobs" />
    </div>
    <!-- <printPayment
        ref="printPayment"
        :project="project"
        :task="task"
        :payment="payment"
        :qualityRecords="qualityRecords"
        :comments="comments"
        :notifys="notifys"
      /> -->
    <!-- 验收打印页面排版 -->

    <div style="visibility: hidden; position: fixed">
      <printAccept
        ref="printAccept"
        :project="project"
        :task="task"
        :payment="payment"
        :codes="codes"
        :comments="comments"
      />
    </div>
  </div>
</template>

<script>
import Vue from 'vue'
import { ACCESS_TOKEN, USER_INFO } from '@/store/mutation-types'
import { getAction, postAction } from '@/api/manage'
import { formatDate } from '@/utils/util'
import { UtilsMixin } from '@/mixins/UtilsMixin'
import { Modal } from 'ant-design-vue'
import { FlowMixin } from '@/mixins/FlowMixin'
import { TableMixin } from '@/mixins/TableMixin'
export default {
  mixins: [UtilsMixin, FlowMixin, TableMixin],
  components: {
    HomeNav: () => import('@/components/layouts/HomeNav'),
    printPayment: () => import('@/views/workReport/payment/printPaymentBatch'),
    printAccept: () => import('@/views/workReport/payment/printAccept'),
    FixedMenu: () => import('@/views/workReport/home/FixedMenu')
  },
  data() {
    return {
      dataTitle: this.$route ? this.$route.name : '',
      currUserId: this.$store.getters.userInfo.username,
      userinfo: {
        info: this.$store.getters.userInfo,
        module: 'ContractReportInfo',
      },
      labelCol: { span: 8 },
      wrapperCol: { span: 15 },
      searchForm: {
        pageNo: 1,
        pageSize: 10,
        pageSizeOptions: ['10', '20', '30'],
        showTotal: (total, range) => {
          return range[0] + '-' + range[1] + ' 共' + total + '条'
        },
        total: 0,
      },
      paymentColumns: [
        {
          title: '状态',
          dataIndex: 'status',
          scopedSlots: { customRender: 'statusRender' },
          width: '90px',
          align: 'center',
        },
        {
          title: '当前步骤',
          dataIndex: 'handlerStep',
          scopedSlots: { customRender: 'handlerStepRender' },
          width: '120px',
          align: 'center',
        },
        {
          title: '当前处理人/接收时间/停留时间',
          dataIndex: 'handlerUser',
          scopedSlots: { customRender: 'currentHandlerRender' },
          width: '250px',
          align: 'center',
        },
        {
          title: '申请流水号',
          dataIndex: 'applyNo',
          scopedSlots: { customRender: 'applyNoRender' },
          width: '130px',
          sorter: true,
        },
        {
          title: '申请人',
          dataIndex: 'applyUserName',
          width: '80px',
          align: 'center',
        },
        {
          title: '合同名称',
          dataIndex: 'contractName',
          width: '200px',
          align: 'center',
        },
        {
          title: '采购订单号',
          dataIndex: 'purchaseOrderNumber',
          width: '140px',
          align: 'center',
        },
        {
          title: 'PO行号',
          dataIndex: 'poLine',
          width: '80px',
          align: 'center',
        },
        {
          title: '本次支付金额(含税)',
          dataIndex: 'payAmount',
          width: '180px',
          align: 'center',
        },
        {
          title: '结算员',
          dataIndex: 'settlementUser',
          width: '100px',
          align: 'center',
        },
        {
          title: '结算时间',
          dataIndex: 'settlementTime',
          width: '160px',
          align: 'center',
          sorter: true,
        },
        {
          title: 'SA单号',
          dataIndex: 'feeReimCode',
          width: '100px',
          align: 'center',
        },
        {
          title: '审批状态',
          dataIndex: 'orderStatus',
          width: '100px',
          scopedSlots: { customRender: 'orderStatusRender' },
          align: 'center',
        },
        {
          title: '业务状态',
          dataIndex: 'bizStatus',
          width: '100px',
          scopedSlots: { customRender: 'bizStatusRender' },
          align: 'center',
        },
        {
          title: '支付日期',
          dataIndex: 'erpPayDate',
          width: '100px',
          align: 'center',
        },
        {
          title: '引用情况',
          dataIndex: 'relatedQualityNos',
          width: '100px',
          scopedSlots: { customRender: 'relatedQualityNosRender' },
          align: 'center',
        },

      ],
      deleteColums: [
        {
          title: '操作',
          width:'150px',
          align: 'center',
          scopedSlots: { customRender: 'actionRender' },
        },
      ],
      pageSizeOptions: ['10', '20', '30', '40', '50'],
      records: [],
      urls: {
        list: '/workReport/payment/page',
        delPayment: '/workReport/payment/delete',
        codes: '/manage/codeInfo/queryByTypes',
        myPermission: '/workReport/project/myPermission',
        syncHteData: '/srm/syncHteData',
        pushSettlementTimeToBi: '/workReport/payment/pushSettlementTimeToBi',
        updateStatus: '/workReport/payment/updateStatus',
        batchUpdateStatus: '/workReport/payment/batchUpdateStatus',
        payment: '/workReport/payment/info',
        task: '/workReport/task/info',
        project: '/workReport/project/info',
        paymentQualityList: '/paymentQuality/list',
        syncHYInfoToHx:'/workReport/payment/updateTaskPaymentSaInfo'
      },
      codes: {},
      permission: [],
      showSearchForm: false,
      keyword: '',
      keywordType: '1',
      settlementTime: [],
      payment: {},
      task: {},
      project: {},
      qualityRecords: [],
      printJobs: [],
      saOrderStatus:[
        {code:'AUDITED',name:'已审批'},{code:'DISABLED',name:'已作废'},
        {code:'DRAFT',name:'草稿'},{code:'SUBMITED',name:'待审批'}
      ],
      saBizStatus:[
        {code:'CREATED',name:'已生成'},{code:'DISABLED',name:'已作废预凭证'},
        {code:'PAID',name:'已支付'},{code:'PART_PAID',name:'部分支付'},
        {code:'UNCREATE',name:'未生成'},{code:'UNPAID',name:'未支付'}
      ]
    }
  },
  mounted() {
    this.fetchList()
    this.fetchPermission()
    this.fetchCodes()
  },
  methods: {
    formatDate,
    fetchPermission() {
      getAction(this.urls.myPermission, { projectId: -1 }).then((res) => {
        if (res.success) {
          this.permission = res.result
        }
      })
    },
    checkPermission(powers) {
      let hasPower = false
      for (let p of powers) {
        if (this.permission.indexOf(p) > -1) {
          hasPower = true
          break
        }
      }
      return hasPower
    },
    fetchCodes() {
      getAction(this.urls.codes, { types: 'WorkReportTaskPaymentStatus' }).then((res) => {
        if (res.success) {
          this.codes = { ...this.codes, ...res.result }
          console.log(JSON.stringify(this.codes))
        }
      })
    },
    async fetchList() {
      if (this.settlementTime[0]) {
        this.$set(this.searchForm, 'settlementTimeStart', this.settlementTime[0])
      } else {
        this.$set(this.searchForm, 'settlementTimeStart', null)
      }
      if (this.settlementTime[1]) {
        this.$set(this.searchForm, 'settlementTimeEnd', this.settlementTime[1])
      } else {
        this.$set(this.searchForm, 'settlementTimeEnd', null)
      }
      let res = await postAction(this.urls.list, { ...this.searchForm, ...this.searchForm })
      if (res.success) {
        this.records = res.result.records
        if (this.records && this.records.length > 0) {
          this.compilePrintData([this.records[0]], 2)
        }
        this.$set(this.searchForm, 'total', res.result.total)
      }
      this.showSearchForm = false
    },
    exportExcle() {
      let url = process.env.VUE_APP_API_BASE_URL + '/workReport/payment/export?1=1'
      this.handleExportXls('验收付款表', url, this.searchForm)
    },
    /**
     * 表结构切换页码
     */
    handleTableChange(searchForm, filters, sorter) {
      // this.searchForm = searchForm
      this.searchForm.pageNo = this.searchForm.pageNo
      this.searchForm.sortField = sorter.field
      this.searchForm.sortOrder = sorter.order
      this.fetchList(this.fileId)
    },
    customRow(record) {
      return {
        on: {
          dblclick: (event) => {
            this.toPaymentDetail(record)
          },
        },
      }
    },
    toPaymentDetail(record) {
      let urlJump = this.$router.resolve({ path: '/workReport/editPayment/' + record.id })
      window.open(urlJump.href, '_blank')
    },
    pageChange(pageNo, pageSize) {
      this.$set(this.searchForm, 'pageSize', pageSize)
      this.$set(this.searchForm, 'pageNo', pageNo)
      this.fetchList()
    },
    onShowSizeChange(pageNo, pageSize) {
      this.searchForm.pageNo = 1
      this.searchForm.pageSize = pageSize
      this.fetchList()
    },
    currentHandlerRenderFunc(record) {
      let text = ''
      if (record.handlerUser) {
        if (record.handlerTime) {
          // text = record.handlerUser + '/' + record.handlerTime
          // var startDate = new Date(record.handlerTime).getTime()
          // var endDate = new Date().getTime()
          // var days = (endDate - startDate) / (1 * 24 * 60 * 60 * 1000)
          // text += '/' + parseInt(days) + '天'
          text = record.handlerUser + '/' + record.handlerTime + '/' + record.stayDays + '天'
        }
      }
      return text
    },
    openSearchForm() {
      this.showSearchForm = true
      if (this.keyword) {
        if (this.keywordType == '1') {
          this.$set(this.searchForm, 'purchaseOrderNumber', this.keyword)
        }
        if (this.keywordType == '2') {
          this.$set(this.searchForm, 'applyNo', this.keyword)
        }
      }
    },
    handleSearch() {
      if (this.keyword) {
        if (this.keywordType == '1') {
          this.$set(this.searchForm, 'purchaseOrderNumber', this.keyword)
          this.$set(this.searchForm, 'applyNo', '')
        }
        if (this.keywordType == '2') {
          this.$set(this.searchForm, 'purchaseOrderNumber', '')
          this.$set(this.searchForm, 'applyNo', this.keyword)
        }
      }
      this.fetchList()
    },
    handleToSearch() {
      this.onShowSizeChange()
    },
    handleToCancel() {
      this.showSearchForm = false
    },
    toDelPayment(record) {
      let that = this
      Modal.confirm({
        title: '提醒',
        content: '是否确认删除合同验收/付款审批表[' + record.applyNo + ']',
        onOk() {
          postAction(that.urls.delPayment + '/' + record.id, {}).then((res) => {
            if (res.success) {
              that.$messageWorkReport.success('删除成功')
              that.fetchList()
            } else {
              that.$messageWorkReport.error('删除失败')
            }
          })
        },
        onCancel() {},
      })
    },
    pushToSrm(record) {
      postAction(this.urls.syncHteData + '?paymentId=' + record.id, {}).then((res) => {
        if (res.success) {
          this.$messageWorkReport.success('推送成功')
        } else {
          this.$messageWorkReport.error('推送失败')
        }
      })
    },
    pushToBi(record) {
      postAction(this.urls.pushSettlementTimeToBi + '?paymentId=' + record.id, {}).then((res) => {
        if (res.success) {
          this.$messageWorkReport.success('推送成功')
        } else {
          this.$messageWorkReport.error('推送失败')
        }
      })
    },
    updateStatus(id) {
      getAction(this.urls.updateStatus + '/' + id).then((res) => {
        if (res.success) {
          this.$messageWorkReport.success('更新成功')
          this.fetchList()
        } else {
          this.$messageWorkReport.error('更新失败')
        }
      })
    },
    batchUpdateStatus(){
      if(this.selectedRowKeys<=0){
        return this.$messageWorkReport.warning('请至少选择一条数据进行更新')
      }
      postAction(this.urls.batchUpdateStatus,this.selectedRowKeys).then((res) => {
        if (res.success) {
          this.$messageWorkReport.success('更新成功')
          this.selectedRowKeys = []
          this.fetchList()
        } else {
          this.$messageWorkReport.error('更新失败')
        }
      })
    },
    async print() {
      if (this.selectedRows && this.selectedRows.length > 0) {
        await this.compilePrintData(this.selectedRows)
        setTimeout(this.$refs.printPayment.print(), 2000)
      } else {
        this.$messageWorkReport.success('请选择一条数据打印')
      }
    },
    async print1() {
      if (this.selectedRows && this.selectedRows.length > 0) {
        await this.compilePrintData(this.selectedRows)
        setTimeout(this.$refs.printAccept.print(), 2000)
      } else {
        this.$messageWorkReport.success('请选择一条数据打印')
      }
    },
    async compilePrintData(selectedRows, type = 1) {
      this.printJobs = []
      if (selectedRows && selectedRows.length > 0) {
        let index = 1
        for (let row of selectedRows) {
          if (type == 1) {
            this.$messageWorkReport.info(
              '正在加载第[' + index + '/' + selectedRows.length + ']个验收付款表[' + row.applyNo + ']打印数据...',
              10
            )
          }
          let job = {}
          this.payment = row
          await this.fetchPayment(this.payment.id)
          await this.fetchTask(this.payment.taskId)
          await this.fetchProject(this.task.projectId)
          await this.fetchQualityList()
          await this.fetchFlowComments(this.payment.processInstanceId)
          await this.fetchFlowNotifys(this.payment.processInstanceId)
          job.payment = this.payment
          job.task = this.task
          job.project = this.project
          job.qualityRecords = [...this.qualityRecords]
          job.comments = [...this.comments]
          job.notifys = [...this.notifys]
          this.printJobs.push(job)
          if (type == 1) {
            this.$messageWorkReport.info(
              '加载第[' + index + '/' + selectedRows.length + ']个验收付款表[' + row.applyNo + ']打印数据完成！'
            )
          }
          index++
        }
      } else {
        this.$messageWorkReport.success('请至少选择一条数据进行打印')
      }
    },
    async fetchPayment(paymentId) {
      let res = await getAction(this.urls.payment + '/' + paymentId, {})
      if (res.success) {
        this.payment = res.result
        if (this.payment.payByLetter != '是') {
          this.$set(this.payment, 'payByLetter', '否')
        }
        if (this.payment.isPrePay != '是') {
          this.$set(this.payment, 'isPrePay', '否')
        }
      }
    },
    async fetchTask(taskId) {
      if (!taskId) {
        return
      }
      let res = await getAction(this.urls.task + '/' + taskId, {})
      if (res.success) {
        this.task = res.result
        if (!this.task) {
          this.task = { currentHandlerUser: '' }
        }
        this.$set(this.payment, 'poLine', this.task.poLine)
        // if (!this.payment.postAmount || !this.payment.payAmount) {
        //   if (this.payment.postAmount != 0 && this.payment.payAmount != 0) {
        //     this.calcReduce()
        //   }
        // }
      }
    },
    async fetchProject() {
      let res = await getAction(this.urls.project + '/' + this.task.projectId, {})
      if (res.success) {
        if (res.result && res.result.poLineCount) {
          res.result.poLineCountCopy = '共' + res.result.poLineCount + '行'
        }
        this.project = res.result
        if (!this.project.waterAndElectricityPay) {
          this.$set(this.project, 'waterAndElectricityPay', '1')
        }
        this.$set(this.payment, 'contractName', this.project.contractName)
      }
    },
    async fetchQualityList() {
      let param = {}
      param.paymentId = this.payment.id
      param.pageSize = 10000
      let res = await postAction(this.urls.paymentQualityList, param)
      if (res.success) {
        this.qualityRecords = res.result
      }
    },

    //转换引用情况
    convertRelateQuality(relateQualityNo,isRelateQuality){
      //console.log('relateQualityNo=',relateQualityNo)
      //console.log('isRelateQuality=',isRelateQuality)
      let result = ''  
      if(!isRelateQuality || isRelateQuality == '0'){
          result = '未引用'
      }else{
        if(relateQualityNo){
          let infoArr = relateQualityNo.split(',')
          let resultArr = []
          infoArr.forEach(item =>{
            resultArr.push("YF$"+item)
          })
          result = resultArr.toString()
        }
      }
      return result
    },

    syncHYInfo(){
      console.log('同步海银信息')        
        let reqUrl = this.urls.syncHYInfoToHx
        let paymentIdList = this.selectedRowKeys
        postAction(reqUrl,paymentIdList).then(res =>{
          if(res.success && res.code === 200){
            this.$messageWorkReport.success('同步海银信息成功')
          }else{
            this.$messageWorkReport.error('同步海银信息失败')
          }
          this.selectedRowKeys = []
          this.fetchList()
        })
    },

    transferCodeToName(mycode,arr){
      //console.log('myCode',mycode)
      //console.log('arr:',arr)
      if(!mycode || mycode == ''){
        return mycode
      }
      let result = ''
      for(let item of arr){
        if(mycode == item.code){
          result = item.name
          break
        }
      }
      return result
    }


  },
}
</script>

<style lang="less" scoped>
@import '~@assets/less/hte-main.less';
.page-main {
  .banner {
    background-image: url(~@assets/contract-top.png);
  }
  .container {
    .content-list {
      margin-top: 15px;
    }
  }
}
</style>
